package com.woniuxy.creditsystem.common.mapper;


import com.woniuxy.creditsystem.common.bean.DataDetailInfo;
import com.woniuxy.creditsystem.common.bean.MoneyChannelInfo;
import org.apache.ibatis.annotations.*;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 数据明细mapper
 *
 * @author 刘川
 */

@Mapper
public interface DataDetailMapper {

    /**
     * 查询所有数据明细
     *
     * @return 数据明细集合
     */
    @Results({
            @Result(id = true, property = "id", column = "id", javaType = Long.class),
            @Result(property = "statisticalDate", column = "statistical_date", javaType = Date.class),
            @Result(property = "firstApplyNums", column = "first_apply_nums", javaType = Long.class),
            @Result(property = "submitAuditNums", column = "submit_audit_nums", javaType = Long.class),
            @Result(property = "auditPassNums", column = "audit_pass_nums", javaType = Long.class),
            @Result(property = "loanOrderNums", column = "loan_order_nums", javaType = Long.class),
            @Result(property = "loanOrderAmount", column = "loan_order_amount", javaType = BigDecimal.class),
    })
    @Select("select * from data_detail_info")
    List<DataDetailInfo> findAll();

    /**
     * 添加数据明细表的数据
     *
     * @param dataDetailInfo
     * @return 返回影响的行数
     */
    @Insert("insert into data_detail_info (statistical_date,first_apply_nums,submit_audit_nums,audit_pass_nums,loan_order_nums,loan_order_amount)" +
            "values(#{d.statisticalDate},#{d.firstApplyNums},#{d.submitAuditNums},#{d.auditPassNums},#{d.loanOrderNums},#{d.loanOrderAmount})")
    int saveDataDetail(@Param("d") DataDetailInfo dataDetailInfo);

}
